<!DOCTYPE html>
<html lang="zh-CN" xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>文档管理</title>
    <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon"/>
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script type="text/javascript" charset="utf-8" src="/static/js/jquery-1.11.3.min.js"></script>
    <script src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
    <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
    <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
</head>
<body>
<div class="x-nav">
      <span class="layui-breadcrumb">
        <a href="/admin/welcomepage">首页</a>
        <a href="javascript:window.location.reload();">
          <cite>文档管理</cite>
        </a>
      </span>
    <a class="layui-btn layui-btn-small" style="line-height:1.6em;margin-top:3px;float:right"
       href="javascript:void(0);" onclick="reload_iframe();" title="刷新">
        <i class="layui-icon" style="line-height:30px">ဂ</i>
    </a>
</div>
<div class="x-body">
    <blockquote class="layui-elem-quote">此处修改和添加系统API文档,修改/添加后可在开发文档也查看!</blockquote>
    <xblock>
        <button class="layui-btn" onclick="x_admin_show('添加文档','/admin/doc/add')"><i class="layui-icon"></i>添加
        </button>
        <span class="x-right" style="line-height:40px" th:text="'共有数据：'+${bean.total}+' 条'"></span>
    </xblock>
    <th:block th:fragment="pageNode">
        <div id="dewdewfef">
            <table class="layui-table">
                <thead>
                <tr>
                    <th>编号</th>
                    <th>标题</th>
                    <th>创建时间</th>
                    <th>是否显示</th>
                    <th>排序</th>
                    <th>操作</th>
                </thead>
                <tbody>
                <tr th:each="o,state:${bean.list}">
                    <td th:text="${o.id}"></td>
                    <td th:text="${o.title}"></td>
                    <td th:text="${#dates.format(o.optTime,'yyyy-MM-dd HH:mm:ss')}"></td>
                    <td th:switch="">
                        <th:block th:case="1">显示</th:block>
                        <th:block th:case="2">不显示</th:block>
                    </td>
                    <td th:text="${o.orderBy}"></td>
                    <td class="td-manage">
                        <a title="编辑"
                           th:onclick="x_admin_show('编辑','/admin/doc/edit?id=[(${o.id!})]')"
                           href="javascript:void(0);">
                            <i class="layui-icon">&#xe63c;</i>
                        </a>&nbsp;&nbsp;&nbsp;
                        <a title="删除" th:onclick="member_del(this,'[(${o.id!})]')"
                           href="javascript:void(0);">
                            <i class="layui-icon">&#xe640;</i>
                        </a>
                    </td>
                </tr>
                </tbody>
            </table>
            <div class="page"
                 th:include="~{include/page2.html::page(${bean},'/admin/doc/list','ajaxForm','dewdewfef')}">
            </div>
            <script>
                $(function () {
                    layui.use('laydate', function () {
                        var laydate = layui.laydate;
                        //执行一个laydate实例
                        laydate.render({
                            elem: '#start' //指定元素
                        });
                        //执行一个laydate实例
                        laydate.render({
                            elem: '#end' //指定元素
                        });
                    });
                });

                function member_del(obj, id) {
                    layer.confirm('确认要删除吗？', function (index) {
                        layer.load(0);
                        $.post("/admin/doc/delete",
                            {"id": id},
                            function (data) {
                                layer.closeAll();
                                layer.msg(data.msg, {icon: 1, time: 800});
                                $(obj).parents("tr").remove();
                                reload_iframe();
                            }, "json");
                    });
                }

                window.onload = close_loading_msg();

                function reload_iframe() {
                    parent.obj = parent.layer.load(0);
                    location.replace(location.href);
                }
            </script>
        </div>
    </th:block>
</div>

</body>
<script>
    layui.use(['form', 'layer'], function () {
        $ = layui.jquery;
    });
</script>
</html>